package com.app.java.nio;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;

/**
 * 将文件 readme.txt 的内容快速复制到文件 out.txt 中.
 * nio的目标就是快速移动大量数据.
 * 
 * @author User
 *
 */
public class TransferTo {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		FileChannel in = new FileInputStream("readme.txt").getChannel();
		
		FileChannel out = new FileOutputStream("out.txt").getChannel();
		
		in.transferTo(0, in.size(), out);
	}

}